package com.zixi.ai.chat.controller;

import com.zixi.ai.ai.core.entity.ToolCallResp;
import com.zixi.ai.chat.service.IMcpService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author wfg
 */
@RestController
@Tag(name = "MCP APIs")
@RequestMapping("/api/v1/mcp")
@RequiredArgsConstructor
public class ZxMcpController {

    private final IMcpService mcpService;

    /**
     * 内部接口不应该直接被 web 请求！
     */
    @GetMapping("/mcp")
    @Operation(summary = "DashScope MCP Chat")
    public Flux<?> mcpChat(@Validated @RequestParam("prompt") String prompt) {
        ToolCallResp rs = mcpService.chat(prompt);
        return Flux.just( rs);
    }
}
